/*
 * @Author: Kingsley
 * @Date: 2018-10-22 21:50:36
 * @Last Modified by: mikey.zhaopeng
 * @Last Modified time: 2018-10-24 22:20:40
 * 加工零件的service实现
 */

import _axios from "@/utils/requestUtil";
import _urlConfig from "@/config/bill/GoodsCateURLConfig";

class GoodsCategory {
  /**
   * 1.获取同一级别下的加工零件的种类列表信息
   * @param {*} requestParam
   */
  getGoodsCates(requestParam) {
    return _axios.request({
      url: _urlConfig.getGoodsCates,
      data: requestParam,
      method: "post"
    });
  }

  /**
   * 2.
   */
  getGoodsCateCascader() {
    return _axios.request({
      url: _urlConfig.getGoodsCateCascader,
      method: "get"
    });
  }

  /**
   *
   * @param {*} requestParam
   * {
   *    parentId : 父级Id,
   *    goodsCategoryName:种类名称，
   *    priority：权重
   * }
   */
  add(requestParam) {
    return _axios.request({
      url: _urlConfig.add,
      data: requestParam,
      method: "post"
    });
  }

  /**
   * 搜索种类列表信息
   * @param {*} requestParam 
   * {
   *    parentId：父级Id，
   *    CategoryName：模糊搜索的种类名称
   * }
   */
  getSearchGoodsCates(requestParam) {
    return _axios.request({
      url: _urlConfig.getSearchGoodsCates,
      data: requestParam,
      method: "post"
    });
  }

  
  /**
   * 更新种类信息
   * @param {*} requestParam
   * { 
   *    id : 更新记录id
   *    parentId : 父级Id,
   *    goodsCategoryName:种类名称，
   *    priority：权重
   * }
   */
  edit(requestParam){
    return _axios.request({
      url: _urlConfig.edit,
      data: requestParam,
      method: "post"
    });
  }
}
export default GoodsCategory;
